package persistent.prestige.console.threadmode.t3.threadpool;

import java.util.concurrent.ThreadFactory;
import java.util.concurrent.atomic.AtomicInteger;

/**
 * 自定义线程工厂
 * 
 * @author dingwei2
 *
 */
public class MyThreadFactory implements ThreadFactory {

	private String threadPrix;
	private AtomicInteger id = new AtomicInteger(0);
	
	public MyThreadFactory() {
		
	}
	
	public MyThreadFactory(String threadPrix) {
		this.threadPrix = threadPrix;
	}

	@Override
	public Thread newThread(Runnable r) {
		// TODO Auto-generated method stub
		Thread t = new Thread(r, threadPrix + "-" + id.getAndIncrement());
		return t;
	}

}
